import { createStore } from "vuex";
import createPersistedState from "vuex-persistedstate";

export default createStore({
  state: {
  },
  mutations: {},
  actions: {},
  getters: {},
  modules: {},
  plugins: [
    // veux持久化配置
    createPersistedState({
      //默认使用localStorage
      // storage: window.sessionStorage,//设置存储成sessionStorage存储
      // key是存储数据的键名
      key: "rabbitstore-client",
      // paths是存储state中的那些数据，如果是模块下具体的数据需要加上模块名称，例如user.name
      //paths: ["user", "cart"],
      paths: [],
      reducer(value) {
        //只存储state.user.name的值
        return {
          //name: value.user.name,
        };
      },
    }),
  ],
});
